Skip to content

output-json: avoid freeing caller-owned JSON builder - #15599

Closed
urvalkheni wants to merge 1 commit into
OISF:mainfrom
urvalkheni:bugfix/smtp-json-builder-ownership-v2
Closed

output-json: avoid freeing caller-owned JSON builder#15599
urvalkheni wants to merge 1 commit into
OISF:mainfrom
urvalkheni:bugfix/smtp-json-builder-ownership-v2

Conversation

@urvalkheni

Copy link
Copy Markdown
Contributor

Supersedes #15594.

Link to ticket:
https://redmine.openinfosecfoundation.org/issues/8647

Describe changes:

  • Stop freeing the caller-owned SCJsonBuilder in EveEmailLogJsonData() when SMTP state is unavailable.
  • Return failure and let the caller handle cleanup.
  • Add defensive NULL checks in EveSmtpDataLogger() for state and vtx.

This is a small correctness/hardening fix to keep ownership handling consistent in the SMTP Eve logging path.

EveEmailLogJsonData() freed the provided SCJsonBuilder when
SMTP state was unavailable, even though ownership remains with
the caller. The caller may continue using the builder for
cleanup after the function returns failure.

Return failure without freeing the builder and add defensive
NULL checks in EveSmtpDataLogger().

Signed-off-by: Urval Kheni <urvalkheni777@gmail.com>
@urvalkheni
urvalkheni requested a review from victorjulien as a code owner June 10, 2026 15:44

@victorjulien victorjulien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, thanks. Weird that the compiler didn't complain about the NULL as bool return.

@victorjulien victorjulien added this to the 9.0 milestone Jun 10, 2026
@victorjulien

Copy link
Copy Markdown
Member

Merged in #15601, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants